package com.itheima;

// 需求:
//         使用方法重载的思想，设计比较两个数据是否相等的方法，兼容全整数类型(byte,short,int,long）
public class Demo05OverLoadTest {
    public static void main(String[] args) {
        byte a = 10, b = 13;
        boolean result = compre(a, b);
        System.out.println(result);
        System.out.println("----------");
        short a1 = 10, b1 = 13;
        result = compre(a1, b1);
        System.out.println(result);
        System.out.println("---------");
        int a2 = 10, b2 = 13;
        result = compre(a2, b2);
        System.out.println(result);
        System.out.println("--------");
        long a3 = 10, b3 = 10;
        result = compre(a3, b3);
        System.out.println(result);


    }

    public static boolean compre(byte a, byte b) {
        System.out.println("两个byte");
        return a == b;
    }

    public static boolean compre(short a, short b) {
        System.out.println("两个short");
        if (a == b) {
            return true;
        }
        return false;
    }

    public static boolean compre(int a, int b) {
        System.out.println("两个int");
        return (a == b) ? true : false;
    }

    public static boolean compre(long a, long b) {
        System.out.println("两个long");
        if (a == b) {
            return true;
        } else {
            return false;
        }
    }
}
